<template>
  <div id="inventory">
    <v-tableTitle title="库容查询"></v-tableTitle>
    <div class="detail">
      <v-navMenu
        :detailNav="detailNav"
        :menuData="menuData"
        @setMentActive="setMentActive"
      ></v-navMenu>
      <keep-alive>
        <component
          :inputData="{ detailData, detailDataFpkw }"
          :is="currentComponent"
        ></component>
      </keep-alive>
    </div>
  </div>
</template>

<script>
import navMenu from "commons/NavMenu";
import baseMixin from "@/mixins/BaseMixin";
import tableTitle from "commons/TableTitle";

export default {
  name: "inventorySearch",
  mixins: [baseMixin],
  data() {
    return {
      selectData: {},
      detailData: {},
      detailDataFpkw: {},
      menuData: [
        { label: "仓库", index: "1" },
        { label: "区域库存", index: "2" },
        { label: "库区库存", index: "3" },
      ],
      detailNav: "1",
      componentConfig: [
        {
          name: "inventory_detail",
          label: "仓库",
          component: () => import("./detail/inventory_detail.vue"),
        },
        {
          name: "inventory_loc",
          label:"区域库存",
          component: () => import("./detail/inventory_loc.vue"),
        },
        {
          name: "inventory_lot",
          label: "库区库存",
          component: () => import("./detail/inventory_lot.vue"),
        },
      ],
      deleteStatus: true,
    };
  },
  computed: {
    currentComponent() {
      return this.componentConfig[this.detailNav - 1].component;
    },
  },
  methods: {
    setMentActive(key) {
      this.detailNav = key;
      console.log(this);
    },
  },
  mounted() {
    // if (Object.keys(this.$store.state.skip).length !== 0) {
    //   let data = this.$store.state.skip;
    //   this.detailData = data.detail;
    //   this.selectData = data.routeData;
    //   this.detailNav = data.detailNav;
    // } else {
    //   this.selectData = this.$store.state.routeData;
    // }
    console.log(this);
  },
  watch: {},
  components: {
    "v-navMenu": navMenu,
    "v-tableTitle": tableTitle,
  },
};
</script>

<style scoped>
#inventory {
  width: 100%;
  height: 99%;
  padding-top: 6px;
}
</style>
